package com.life.view;

import java.awt.Color;
import java.awt.Graphics;

public class ColorGenerator {
	
	static Color[] colorArray = null;
	static Color backgroundColor = null;
	static Color addedLifeColor = null;
	static Color statColor = null;
	
	private static ColorGenerator thisRef = null;
	
	private ColorGenerator()
	{
		colorArray = new Color[9];
		setColor(0,Color.GRAY);
		setColor(1,new Color(255,0,0));
		setColor(2,Color.orange);
		setColor(3,Color.yellow);
		setColor(4,new Color(140,255,5));
		setColor(5,new Color(5,255,64));
		setColor(6,new Color(5,246,255));
		setColor(7,new Color(5,70,255));
		setColor(8,new Color(146,5,255));	
		
		backgroundColor = new Color(0,0,0);
		addedLifeColor = new Color(255,255,255);
		statColor = new Color(128,128,128,150);
	}
	
	public static ColorGenerator getInstance()
	{
		if(thisRef == null)
		{
			thisRef = new ColorGenerator();
		}
		
		return thisRef;			
	}
	
	public void setColor(int neighbor, int r, int g, int b)
	{
		setColor(neighbor,new Color(r,g,b));
	}
	
	public void setColor(int neighbor, Color color)
	{
		colorArray[neighbor]=color;
	}
	
	public static Color getNeighborColor(int neighbors)
	{
		return colorArray[neighbors%colorArray.length];
	}
	
	public static Color getBackgroundColor()
	{
		return backgroundColor;
	}
	
	public static Color getAddedLifeColor()
	{
		return addedLifeColor;
	}

	public static Color getStatisticsColor()
	{
	    return statColor;
	}
	
}
